package com.googlecode.icecube.presentation;


import com.googlecode.icefusion.ui.commons.form.ITableRowSortable;


/**
 * Simple example for a row object definition that allows to have a sortable table presentation for Java authors.
 * 
 * @author Rainer Eschen
 * 
 */
public class DataTableRow4JavaAuthors implements ITableRowSortable {

	private static final long serialVersionUID = -8749491492441794619L;

	private String firstname;

	private String lastname;

	private String homepage;

	private Boolean jsfFocus;

	public DataTableRow4JavaAuthors(String firstname, String lastname, String homepage, Boolean jsfFocus) {

		this.firstname = firstname;
		this.lastname = lastname;
		this.homepage = homepage;
		this.jsfFocus = jsfFocus;
	}

	public int compareByAttribute(ITableRowSortable object, String attribute) {

		if (attribute.equals("firstname")) {
			return this.firstname.compareTo(((DataTableRow4JavaAuthors)object).getFirstname());
		}

		if (attribute.equals("lastname")) {
			return this.lastname.compareTo(((DataTableRow4JavaAuthors)object).getLastname());
		}

		if (attribute.equals("homepage")) {
			return this.homepage.compareTo(((DataTableRow4JavaAuthors)object).getHomepage());
		}

		if (attribute.equals("jsfFocus")) {
			return this.jsfFocus.compareTo(((DataTableRow4JavaAuthors)object).getJsfFocus());
		}
		return 0;
	}

	public String getFirstname() {
		return firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	public String getHomepage() {
		return homepage;
	}

	public void setHomepage(String homepage) {
		this.homepage = homepage;
	}

	public Boolean getJsfFocus() {
		return jsfFocus;
	}

	public void setJsfFocus(Boolean jsfFocus) {
		this.jsfFocus = jsfFocus;
	}

}
